import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:jinke/page/instruct/widgets/cell.dart';

import '../../utils/component/page_state/widgets/empty.dart';
import 'index.dart';
import 'widgets/widgets.dart';

class InstructPage extends StatelessWidget {
  InstructPage({Key? key}) : super(key: key);
  final controller = Get.put(InstructController());
  // 主视图
  Widget _buildView() {
    return controller.state.lists.length==0?EmptyView():ListView.builder(
      itemBuilder: ((context, index) {
        // if (index == 0) {
        //   return InstructionNewCell();
        // }
        return InstructionCell(index);
      }),
      itemCount: controller.state.lists.length,
    );
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<InstructController>(
      builder: (_) {
        return Scaffold(
          body:  _buildView(),
        );
      },
    );
  }
}
